package com.wxzhou.wangzhuan.config;

import jakarta.enterprise.context.ApplicationScoped;
import org.eclipse.microprofile.config.inject.ConfigProperty;

@ApplicationScoped
public class ApiSecurityConfig {
    @ConfigProperty(name = "macplugin.api.security.enabled", defaultValue = "false")
    boolean enabled;
    @ConfigProperty(name = "macplugin.api.security.mode", defaultValue = "bidirectional")
    String mode;
    @ConfigProperty(name = "macplugin.api.security.base.secret.key")
    String baseSecretKey;
    @ConfigProperty(name = "macplugin.api.security.dynamic.key.enabled", defaultValue = "true")
    boolean dynamicKeyEnabled;
    @ConfigProperty(name = "macplugin.api.security.salt.length", defaultValue = "32")
    int saltLength;
    @ConfigProperty(name = "macplugin.api.security.time.window.seconds", defaultValue = "10")
    int timeWindowSeconds;
    @ConfigProperty(name = "macplugin.api.security.max.clock.skew.seconds", defaultValue = "30")
    int maxClockSkewSeconds;
    @ConfigProperty(name = "macplugin.api.security.encryption.algorithm", defaultValue = "AES-256-GCM")
    String encryptionAlgorithm;
    @ConfigProperty(name = "macplugin.api.security.signature.algorithm", defaultValue = "HMAC-SHA256")
    String signatureAlgorithm;
    @ConfigProperty(name = "macplugin.api.security.replay.protection.enabled", defaultValue = "true")
    boolean replayProtectionEnabled;
    @ConfigProperty(name = "macplugin.api.security.signature.cache.ttl", defaultValue = "20")
    int signatureCacheTtl;
    @ConfigProperty(name = "macplugin.api.security.max.requests.per.window", defaultValue = "100")
    int maxRequestsPerWindow;

    // Getters and Setters
    public boolean isEnabled() {
        return enabled;
    }

    public void setEnabled(boolean enabled) {
        this.enabled = enabled;
    }

    public String getMode() {
        return mode;
    }

    public void setMode(String mode) {
        this.mode = mode;
    }

    public String getBaseSecretKey() {
        return baseSecretKey;
    }

    public void setBaseSecretKey(String baseSecretKey) {
        this.baseSecretKey = baseSecretKey;
    }

    public boolean isDynamicKeyEnabled() {
        return dynamicKeyEnabled;
    }

    public void setDynamicKeyEnabled(boolean dynamicKeyEnabled) {
        this.dynamicKeyEnabled = dynamicKeyEnabled;
    }

    public int getSaltLength() {
        return saltLength;
    }

    public void setSaltLength(int saltLength) {
        this.saltLength = saltLength;
    }

    public int getTimeWindowSeconds() {
        return timeWindowSeconds;
    }

    public void setTimeWindowSeconds(int timeWindowSeconds) {
        this.timeWindowSeconds = timeWindowSeconds;
    }

    public int getMaxClockSkewSeconds() {
        return maxClockSkewSeconds;
    }

    public void setMaxClockSkewSeconds(int maxClockSkewSeconds) {
        this.maxClockSkewSeconds = maxClockSkewSeconds;
    }

    public String getEncryptionAlgorithm() {
        return encryptionAlgorithm;
    }

    public void setEncryptionAlgorithm(String encryptionAlgorithm) {
        this.encryptionAlgorithm = encryptionAlgorithm;
    }

    public String getSignatureAlgorithm() {
        return signatureAlgorithm;
    }

    public void setSignatureAlgorithm(String signatureAlgorithm) {
        this.signatureAlgorithm = signatureAlgorithm;
    }

    public boolean isReplayProtectionEnabled() {
        return replayProtectionEnabled;
    }

    public void setReplayProtectionEnabled(boolean replayProtectionEnabled) {
        this.replayProtectionEnabled = replayProtectionEnabled;
    }

    public int getSignatureCacheTtl() {
        return signatureCacheTtl;
    }

    public void setSignatureCacheTtl(int signatureCacheTtl) {
        this.signatureCacheTtl = signatureCacheTtl;
    }

    public int getMaxRequestsPerWindow() {
        return maxRequestsPerWindow;
    }

    public void setMaxRequestsPerWindow(int maxRequestsPerWindow) {
        this.maxRequestsPerWindow = maxRequestsPerWindow;
    }
}